<template>
  <fileListView :file-list="files" />
</template>

<script>
import fileListView from './fileListView.vue'
import { gets } from '@/api/base/file'
export default {
  components: {
    fileListView
  },
  props: {
    fileKey: {
      type: String,
      default: null
    },
    tag: {
      type: String,
      default: null
    },
    linkBizPk: {
      type: String,
      default: null
    },
    isLoad: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      files: null
    }
  },
  watch: {
    isLoad: {
      handler(val) {
        if (val) {
          this.reset()
        } else {
          this.files = []
        }
      },
      immediate: true
    }
  },
  methods: {
    async reset() {
      this.files = await gets(this.fileKey, this.linkBizPk, this.tag)
    }
  }
}
</script>
